// @Author EthanScriptOn
// @Desc
package config_source_loader

import (
	"gitee.com/fatzeng/srf_switch_basic_components/proxy/interceptor"
	"gitee.com/fatzeng/srf_switch_config/config_define"
	"gitee.com/fatzeng/srf_switch_config/config_node"
)

type SourceLoader interface {
	interceptor.ConditionChecker
	ReadContent() ([]string, error)
	GetConfigSourceType() config_define.ConfigSourceType
	LoadConfigSource() (interface{}, error)
	SetSource(source interface{}) error
	Initialization() error
}

type ConfigSourceLoaderSteps interface {
	SplitSegment(lineDescribes []*SegmentLineDescribe) ([]Segment, error)
	ConvertLineDescribe(lines []string) ([]*SegmentLineDescribe, error)
	ConvertSegmentToMap(sourceLoaderNode *config_node.SourceLoaderNode) (map[string]interface{}, error)
	IsAnnotation(line string) bool
}

type Segment []*SegmentLineDescribe

type SegmentLineDescribe struct {
	multiKeySlice   []*SegmentLineKeyDescribe
	content         string
	originalContent string
}

type SegmentLineKeyDescribe struct {
	key     string
	index   int
	level   int
	isSLice bool
}

type TagIndexPair struct {
	tag string
	idx int
}
